package cn.com.generaldata.os.ws.impl.web;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.nutz.ioc.annotation.InjectName;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cn.com.generaldata.os.constant.ReportConstant;
import cn.com.generaldata.os.service.common.UserService;
import cn.com.generaldata.os.vo.UserVO;

@InjectName
@Component
public class UserAction2 {
	private static Logger log = LoggerFactory.getLogger(UserAction2.class);

	@Autowired
	private UserService userService;

	@At("/company/unit/find")
	@Ok("jsp:/static/company/unit/find")
	public List<UserVO> selectUser() {
		List<UserVO> users = new ArrayList<UserVO>();
		List<String> areas = new ArrayList<String>();
		HashMap map = new HashMap();
		areas.add(ReportConstant.NT_AREA_ID);
		areas.add(ReportConstant.LYG_AREA_ID);
		areas.add(ReportConstant.YC_AREA_ID);
		String hql = "from User u where u.area.id in(:ids)  and u.role.id='4'";
		map.put("ids", areas.toArray());
		users = userService.toVoResult(userService.queryUsersByHql(hql, map, null)).getOperationResult();
		return users;
	}
}
